package com.cluster.platform.controller;

import com.cluster.platform.common.api.CommonResult;
import com.cluster.platform.dto.SysCheckInfoDto;
import com.cluster.platform.model.SysCheckInfo;
import com.cluster.platform.service.SysCheckInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName: SysCheckInfoController
 */
@Controller
@Api(tags = "规则校验接口", value = "SysCheckInfoController")
@RequestMapping("/sysCheck")
public class SysCheckInfoController {

    @Autowired
    SysCheckInfoService sysCheckInfoService;

    @ApiOperation("批量操作")
    @RequestMapping(value = "/batchSysCheck", method = RequestMethod.PUT)
    @ResponseBody
    public CommonResult<Object> batchSysCheck(@RequestParam("status") Integer status, @RequestParam("ids") List<String> ids) {
        return sysCheckInfoService.batchSysCheck(status,ids);
    }

    @ApiOperation("获取规则校验信息--分页查询")
    @RequestMapping(value = "/searchSysCheckPage", method = RequestMethod.POST)
    @ResponseBody
    public CommonResult<Object> searchSysCheckPage(@RequestBody SysCheckInfoDto sysCheckInfoDto) {
        return sysCheckInfoService.fetchList(sysCheckInfoDto);
    }

    @ApiOperation("获取规则校验信息")
    @RequestMapping(value = "/searchSysCheck", method = RequestMethod.POST)
    @ResponseBody
    public CommonResult<Object> searchSysCheck(@RequestBody SysCheckInfo sysCheckInfo) {
        return sysCheckInfoService.searchSysCheckInfo(sysCheckInfo);
    }

    @ApiOperation("新增规则校验信息")
    @RequestMapping(value = "/addSysCheck", method = RequestMethod.POST)
    @ResponseBody
    public CommonResult<Object> addSysCheck(@RequestBody SysCheckInfo sysCheckInfo) {
        return sysCheckInfoService.addSysCheckInfo(sysCheckInfo);
    }

    @ApiOperation("修改规则校验信息")
    @RequestMapping(value = "/updateSysCheck", method = RequestMethod.PUT)
    @ResponseBody
    public CommonResult<Object> updateSysCheck(@RequestBody SysCheckInfo sysCheckInfo) {
        return sysCheckInfoService.updateSysCheckInfo(sysCheckInfo);
    }

    @ApiOperation("删除规则校验信息")
    @RequestMapping(value = "/delSysCheck", method = RequestMethod.DELETE)
    @ResponseBody
    public CommonResult<Object> delSysCheck(@RequestBody SysCheckInfo sysCheckInfo) {
        return sysCheckInfoService.delSysCheckInfo(sysCheckInfo);
    }
}
